/*
 * UARTDriver.hpp
 *
 *  Created on: Jun 4, 2016
 *      Author: Yang
 */

#ifndef UARTDRIVER_HPP_
#define UARTDRIVER_HPP_

#include "stm32f4xx_hal.h"
#include "Peripherals.hpp"

class USART_DARIVER
{
public:
    USART_DARIVER()
    {
        port = huart6;
    }
    USART_DARIVER(UART_HandleTypeDef port0)
    {
        port = port0;
    }
    void operator ()(UART_HandleTypeDef port0)
    {
        port = port0;
    }
    void printf(char* fmt, ...);
    void Transmit( uint8_t *pData, uint16_t Size, uint32_t Timeout);
private:
    UART_HandleTypeDef port;
    void printch(char ch);
    void printdec(int dec);
    void printflt(double flt);
    void printstr(char* str);
    void printbin(int bin);
    void printhex(int hex);
};

#endif /* UARTDRIVER_H_ */

